<?php

namespace app\common\model;

use think\Model;


class OrderGoods extends Model
{

    

    

    // 表名
    protected $name = 'order_goods';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];



    public function getImagesAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['images']) ? $data['images'] : '');
        return get_app_image_url($value);
    }

    public function getThumbnailimageAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['thumbnailimage']) ? $data['thumbnailimage'] : '');
        return get_app_image_url($value);
    }






    public function goods()
    {
        return $this->belongsTo('Goods', 'goods_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function order()
    {
        return $this->belongsTo('order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
    /**
     * 新增
     * */
    public static function add(){

    }
}
